package com.changgou.service.goods.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.changgou.goods.pojo.Brand;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

//import tk.mybatis.mapper.common.Mapper;
@Mapper
public interface BrandMapper extends BaseMapper<Brand> {
    @Select("select * from tb_brand")
    Page<Brand> selectAll();


    /**
     * 根据分类名称查询品牌列表
     *
     * @param categroyName
     * @return
     */
    @Select("select name,image from tb_brand where id in (select brand_id from tb_category_brand where category_id in (select id from tb_category where name = #{name})) order by seq")
    public List<Map> findListByCategroyName(@Param("name") String categroyName);

}
